package com.zt.rongda.web.controller;

import com.zt.rongda.sign.model.Sign;
import com.zt.rongda.sign.service.SignService;
import com.zt.rongda.web.service.WebService;
import com.zt.servlet.ReqBean;
import com.zt.servlet.RequestAttribute;
import com.zt.servlet.Response;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/web")
public class WebController {

    @Autowired
    private WebService webService;

    /**
     * 资源检查模糊搜索
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/resCheckFuzzyQuery")
    @ResponseBody
    public JSONObject resCheckFuzzyQuery(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        return Response.response(webService.resCheckFuzzyQuery(reqBean));
    }

    /**
     * app扫码
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/appScanCode")
    @ResponseBody
    public JSONObject appScanCode(@RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        return Response.response(webService.appScanCode(reqBean.getInfo("maintenanceStr"), reqBean.getInfo("empId")));
    }

    /**
     * app报修申请
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/appMtApply")
    @ResponseBody
    public JSONObject appMtApply(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        webService.appMtApply(reqBean);
        return Response.responseSuccess();
    }



}
